package com.toolbar;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.CardView;
import android.view.View;
import android.widget.ImageView;

public class MyCardView extends AppCompatActivity {
    private CardView cardView;
    private int count = 0;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_my_card_view);

        cardView = findViewById(R.id.id_cv);

        cardView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                runAnim();
            }
        });
    }

    private void runAnim() {
        cardView.animate().translationX(100 + count).setDuration(10000).start();
        count += 10;
    }
}
